home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 001-100 / 001-025 / 006 / mult / mult.help < prev    next >
Text File  |  1995-03-17  |  3KB  |  60 lines

  1.  
  2. usage: mult [-a] [-d] [-fn] [-Fc] [file ...]
  3.     outputs 2nd, 3rd, ... of multiple lines
  4.     -a = also output 1st one of multiple lines
  5.     -d = debug
  6.     -fn = use field number n to compare instead of line, 1=1st field
  7.           n is in decimal
  8.     -Fc = use character 'c' as the field separator instead of white space
  9.  
  10. Mult reads the input (stdin or file(s)), comparing adjacent lines or
  11. comparing the same numbered field in adjacent lines when the -f flag
  12. is given, and outputing lines to stdout whose entire line (no -f flag)
  13. or whose field number n (yes -f flag given) are the same.
  14.  
  15. In the normal case, the second, and succeeding copies of repeated
  16. lines are output to stdout, however the -a flag causes the first
  17. of multiples lines to be output.
  18.  
  19. Note that repeated lines must be adjacent, see sort(1).
  20. This tool is sort of (pun intended) the opposite of uniq.
  21.  
  22. Example:
  23.     Print all people who are using the same password on multiple logins.
  24.     sort -t: +1 /etc/passwd | mult -a -f2 -F:
  25.  
  26. Notation in examples below:
  27. In the examples below, double quotes represent the beginning and end
  28. of the line respectively, and are shown to make the visibilty of trailing
  29. white space explicit. The text between angled brackets < and > represents
  30. the field, spaces are significant between angled brackets.  <> represents
  31. the field of zero characters, and can only happen when the -F flag is
  32. used.  <UNDEF> is a special way to mean that the field is not present
  33. in the line.
  34.  
  35. If no -F flag is given, then the first field starts with the first
  36. non-white character in the line.  For example:
  37. "abc def"        # field 1 = <abc>, field 2 = <def>, field 3 = <UNDEF>
  38. " abc def"        # field 1 = <abc>, field 2 = <def>, field 3 = <UNDEF>
  39. "  abc  def   "        # same even when trailing white space after def
  40.  
  41. However, if the -F flag is given, then the first field starts with
  42. the first character of the line.  If the -F character was not a space,
  43. then space characters are considered to be part of the field (5th example
  44. below). For example, given the input lines with the -F: flag:
  45. "abc:def:"    # field 1 = <abc>, field 2 = <def> field 3 = <UNDEF>
  46. " abc:def:"    # field 1 = <abc>, field 2 = <def> field 3 = <UNDEF>
  47. ":def"        # field 1 = <>, field 2 = <def>, field 3 = <UNDEF>
  48. ":def:"        # field 1 = <>, field 2 = <def>, field 3 = <UNDEF>
  49. ":def: "    # field 1 = <>, field 2 = <def>, field 3 = < >, field 4 = <UNDEF>
  50. ":def::"    # field 1 = <>, field 2 = <def>, field 3 = <>, field 4 = <UNDEF>
  51.  
  52.  
  53. If a field number whose value is <UNDEF> because it is past the end of
  54. the last field, then the comparison against any adjacent line will
  55. always fail.  However the comparison of <> to <> will succeeed, for example
  56. given -F: then field 1 of the two lines
  57. ":ab"
  58. ":cd"
  59. are both <>, so field 1 of both lines are equal.
  60.